<?php

class Iso_writer{
	public function __construct()
	{
		$ci =& get_instance();
		$ci->iso_writer = $this;
	}
	public function build($filename,$dir,$log)
	{
		$cmd = sprintf('"'.FCPATH.'application/libraries/iso_writer/tools/mkisofs.exe"'.' -r -J -o %s %s 2> %s',escapeshellarg($filename),escapeshellarg($dir),escapeshellarg($log));
		echo $cmd.'<br/>';
        $r =  exec($cmd,$result);

        echo($r);
        return $result;
        if ($res === false) {
            return "Unable to run 'mkisofs'.";
        }
        if ($ec != 0) {
            return sprintf("mkisofs error code %d while making ISO.", $ec);
        }
	}
}